/**
 * @format
 */
import {AppRegistry} from 'react-native';
import {name as appName} from './app.json';
import {createAppContainer, createBottomTabNavigator, createStackNavigator} from 'react-navigation';

import './Global.js'; // 导出全局属性
import './pages/utils/JsonUtil'; // 导入工具类
import Page1 from './pages/mainPages/Page1/Page1';
import Page2 from './pages/mainPages/Page2/Page2';
import Page3 from './pages/mainPages/Page3/Page3';
import Page4 from './pages/mainPages/Page4/Page4';
import Page5 from './pages/mainPages/Page5/Page5';


import Detail1 from './pages/otherPages/Detail1/Detail1';
import Detail2 from './pages/otherPages/Detail2/Detail2';
// console.ignoredYellowBox = ['Warning: BackAndroid is deprecated. Please use BackHandler instead.','source.uri should not be an empty string','Invalid props.style key'];
console.disableYellowBox = true; // 关闭全部黄色警告

// 主界面（带四个Tab）
const MainScreenNavigator = createBottomTabNavigator(
    {
        Page1: {screen: Page1, navigationOptions: () => ({})},
        Page2: {screen: Page2, navigationOptions: () => ({})},
        Page3: {screen: Page3, navigationOptions: () => ({})},
        Page4: {screen: Page4, navigationOptions: () => ({})},
        Page5: {screen: Page5, navigationOptions: () => ({})},
    },
    {
        //初始tab位置
        initialRouteName: 'Page1',
        headerMode: 'screen',
        //tab bar的位置, 可选值： 'top' or 'bottom'
        tabBarPosition: 'bottom',
        //是否允许滑动切换tab页
        swipeEnabled: false,
        //是否在切换tab页时使用动画
        animationEnabled: true,
        //是否懒加载
        lazy: true,
        //返回按钮是否会导致tab切换到初始tab页？ 如果是，则设置为initialRoute，否则为none。 缺省为initialRoute。
        backBehavior: 'initialRoute',

        tabBarOptions: {
            //当前选中的tab bar的文本颜色和图标颜色
            activeTintColor: '#4BC1D2',
            //当前未选中的tab bar的文本颜色和图标颜色
            inactiveTintColor: '#000',
            //是否显示tab bar的图标，默认是false
            showIcon: true,
            //showLabel - 是否显示tab bar的文本，默认是true
            showLabel: true,
            //是否将文本转换为大写，默认是true
            upperCaseLabel: false,
            //material design中的波纹颜色(仅支持Android >= 5.0)
            //pressColor: '#788493',
            //按下tab bar时的不透明度(仅支持iOS和Android < 5.0).
            //pressOpacity: 0.8,
            //tab bar的样式
            style: {
                backgroundColor: '#fff',
                paddingBottom: 1,
                borderTopWidth: 0.2,
                paddingTop: 5,
                borderTopColor: '#ccc',
                //height:60,//设置 tab bar 的高度
            },
            //tab bar的文本样式
            labelStyle: {
                fontSize: 12,
                margin: 1
            },
            //tab 页指示符的样式 (tab页下面的一条线).
            indicatorStyle: {height: 0},
        },

    }
);

// Tab界面内需要重新打开Page的界面
const MyNavigator = createStackNavigator({
        Main: {screen: MainScreenNavigator, navigationOptions: () => ({header:null})},//去掉Tab界面的TitleBar必须在这里null，在其它地方不生效
        Detail1: {screen: Detail1},
        Detail2: {screen: Detail2},
    /*
    * onPress={() => {
    *     this.props.navigation.navigate('Detail1', {title: 'Detail1', des: '信息'})
    * }}
    * */
    }, {initialRouteName: 'Main'}
);

const MyContainer = createAppContainer(MyNavigator);


AppRegistry.registerComponent(appName, () => MyContainer);



